<?php
/**
 * Author Yulin
 * Email  dwzhanglong@126.com
 * Date   2017-7-21
 * Func   注册登录
 */
defined('IN_YuLin') || exit('NO PERMIT!');

UserLogin(U($m.'/'.$c.'/'.$a));

$uid       = $_SESSION['uid'];
$userTable = Table('user');
// 获取用户信息，检查是否有设置安全码

$address = getaddress($_user['last_ip']);
$address = empty($address) ? '未知地点' : $address;
$safeCheckSql = 'SELECT id, safepwd, safe_question FROM ' . $userTable . ' WHERE id = ' . $uid . ' AND safepwd !=""';
$safeInfo     = $db->getrow($safeCheckSql);
// 检查安全设置项，方便前台星级评分
$defaultSafeLv = 1;
if ($safeInfo['safepwd']) $defaultSafeLv++;
if ($safeInfo['safe_question']) $defaultSafeLv++;

$dt = NoBadStr($_GET['dtrange']);
$dt = explode(' - ',$dt);
!$dt[0] && $dt[0] = date('Y-m-d',strtotime('-1 day'));
!$dt[1] && $dt[1] = date('Y-m-d');
$dtrange = implode(' - ',$dt);

$sql = 'SELECT SUM(balance) AS balance,SUM(recharge) AS recharge,SUM(cash) AS cash,SUM(prize) AS prize,SUM(invest) AS invest,SUM(investback) AS investback,SUM(dahe) AS dahe,';
$sql.= 'SUM(interest) AS interest FROM '.Table('user_money_count').' WHERE uid = '.$_uid.' AND dateline >= '.strtotime($dt[0]).' AND dateline < '.strtotime($dt[1]);
$data = $db->getrow($sql);

$head['title'] = '个人总览';

$tpl->display('member/securityCenter');